$OpenBSD: patch-Makefile,v 1.4 2011/09/23 07:24:04 dcoppa Exp $
--- Makefile.orig	Mon May 30 09:29:58 2011
+++ Makefile	Fri Sep 23 09:18:31 2011
@@ -11,29 +11,28 @@ DINSTALLLIB=$(DESTDIR)$(INSTALLLIB)
 DINSTALLMAN=$(DESTDIR)$(INSTALLMAN)
 DINSTALLINCLUDE=$(DESTDIR)$(INSTALLINCLUDE)
 
-MAJOR=$(shell sh version.sh --major)
+MAJOR?=$(shell sh version.sh --major)
+MINOR?=$(shell sh version.sh --revision)
 VERSION=$(shell sh version.sh)
+LIBVER?=$(MAJOR).$(MINOR)
 
-WARNFLAGS+=-pedantic -Wall -W -Wundef \
+WARNFLAGS+=-pedantic -W -Wundef \
            -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast \
            -Wcast-align -Wwrite-strings -Wstrict-prototypes \
            -Wmissing-prototypes -Wnested-externs -Winline \
-           -Wdisabled-optimization -Wno-missing-field-initializers
-LIBSUFFIX=$(shell sh platform.sh libsuffix)
-VERLIBSUFFIX=$(shell sh platform.sh libsuffix $(MAJOR))
+           -Wdisabled-optimization
+LIBSUFFIX=$(shell sh platform.sh libsuffix $(LIBVER))
 DYNLIBFLAG=$(shell sh platform.sh dynlibflag)
-LIBNAMEFLAG=$(shell sh platform.sh libnameflag $(MAJOR) $(INSTALLLIB))
 LIBS=$(shell sh platform.sh extralibs)
  
-CFLAGS?=-pipe -O2 $(WARNFLAGS)
-CFLAGS+=-g # TODO(sissel): Comment before release
+CFLAGS?=-pipe -O2 -Wall
 
-DEFAULT_LIBS=-L/usr/X11R6/lib -L/usr/local/lib -lX11 -lXtst -lXinerama
-DEFAULT_INC=-I/usr/X11R6/include -I/usr/local/include
+DEFAULT_LIBS=-L{X11BASE}/lib -lX11 -lXtst -lXinerama
+DEFAULT_INC=-I${X11BASE}/include
 
 LIBS+=$(shell pkg-config --libs x11 xtst xinerama 2> /dev/null || echo "$(DEFAULT_LIBS)")
 INC=$(shell pkg-config --cflags x11 xtst xinerama 2> /dev/null || echo "$(DEFAULT_INC)")
-CFLAGS+=-std=c99 $(INC)
+CFLAGS+=-std=c99 $(WARNFLAGS) $(INC)
 
 CMDOBJS= cmd_click.o cmd_mousemove.o cmd_mousemove_relative.o cmd_mousedown.o \
          cmd_mouseup.o cmd_getmouselocation.o cmd_type.o cmd_key.o \
@@ -51,7 +50,7 @@ CMDOBJS= cmd_click.o cmd_mousemove.o cmd_mousemove_rel
          cmd_sleep.o cmd_get_display_geometry.o
 
 .PHONY: all
-all: xdotool.1 libxdo.$(LIBSUFFIX) libxdo.$(VERLIBSUFFIX) xdotool
+all: xdotool.1 libxdo.$(LIBSUFFIX) xdotool
 
 .PHONY: static
 static: xdotool.static
@@ -83,23 +82,22 @@ post-install:
 .PHONY: installprog
 installprog: xdotool
 	install -d $(DINSTALLBIN)
-	install -m 755 xdotool $(DINSTALLBIN)/
+	${INSTALL_PROGRAM} xdotool $(DINSTALLBIN)/
 
 .PHONY: installlib
 installlib: libxdo.$(LIBSUFFIX)
 	install -d $(DINSTALLLIB)
-	install libxdo.$(LIBSUFFIX) $(DINSTALLLIB)/libxdo.$(VERLIBSUFFIX)
-	ln -sf libxdo.$(VERLIBSUFFIX) $(DINSTALLLIB)/libxdo.$(LIBSUFFIX)
+	${INSTALL_DATA} libxdo.$(LIBSUFFIX) $(DINSTALLLIB)/
 
 .PHONY: installheader
 installheader: xdo.h
 	install -d $(DINSTALLINCLUDE)
-	install xdo.h $(DINSTALLINCLUDE)/xdo.h
+	${INSTALL_DATA} xdo.h $(DINSTALLINCLUDE)/xdo.h
 
 .PHONY: installman
 installman: xdotool.1
 	install -d $(DINSTALLMAN)/man1
-	install -m 644 xdotool.1 $(DINSTALLMAN)/man1/
+	${INSTALL_MAN} xdotool.1 $(DINSTALLMAN)/man1/
 
 .PHONY: deinstall
 deinstall: uninstall
@@ -109,12 +107,11 @@ uninstall: 
 	rm -f $(DINSTALLBIN)/xdotool
 	rm -f $(DINSTALLMAN)/xdotool.1
 	rm -f $(DINSTALLLIB)/libxdo.$(LIBSUFFIX)
-	rm -f $(DINSTALLLIB)/libxdo.$(VERLIBSUFFIX)
 
 .PHONY: clean
 clean:
 	rm -f *.o xdotool xdotool.static xdotool.1 xdotool.html \
-	      libxdo.$(LIBSUFFIX) libxdo.$(VERLIBSUFFIX) libxdo.a || true
+	      libxdo.$(LIBSUFFIX) libxdo.a || true
 
 xdo.o: xdo.c xdo_version.h
 	$(CC) $(CFLAGS) -fPIC -c xdo.c
@@ -130,14 +127,11 @@ xdo.c: xdo.h
 xdotool.c: xdo.h
 
 libxdo.$(LIBSUFFIX): xdo.o xdo_search.o
-	$(CC) $(LDFLAGS) $(DYNLIBFLAG) $(LIBNAMEFLAG) xdo.o xdo_search.o -o $@ $(LIBS)
+	$(CC) $(LDFLAGS) $(DYNLIBFLAG) xdo.o xdo_search.o -o $@ $(LIBS)
 
 libxdo.a: xdo.o xdo_search.o
 	ar qv $@ xdo.o xdo_search.o
 
-libxdo.$(VERLIBSUFFIX): libxdo.$(LIBSUFFIX)
-	ln -s $< $@
-
 # xdotool the binary requires libX11 now for XSelectInput and friends.
 # This requirement will go away once more things are refactored into
 # libxdo.
@@ -165,7 +159,7 @@ package: test-package-build create-package create-pack
 package-deb: test-package-build create-package-deb
 
 .PHONY: test
-test: xdotool libxdo.$(VERLIBSUFFIX)
+test: xdotool libxdo.$(LIBSUFFIX)
 	$(MAKE) -C t
 
 xdo_version.h:
